package com.net.xpay.web.scheduler;


import com.net.xpay.common.service.ApiMonitorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 2019/7/15 16:28

 */
@Slf4j
@Component
public class ApiMonitorScheduler {

    @Autowired
    private ApiMonitorService apiMonitorService;

    /**
     * 监控数据每小时汇报一次
     */
    @Scheduled(cron = "0 0 */1 * * ?")
    public void saveApiMonitorData() {
        try {
            apiMonitorService.flushMonitorData();
        } catch (Exception e) {
            log.info("saveApiMonitorData error", e);
        }
    }

}
